Skip to content

Fix double resolve() in route-for utilities#3206

Merged
laurakwhit merged 3 commits intocodefreeze-03.02.26from
fix-double-resolved-base-path
Mar 2, 2026
Merged

Fix double resolve() in route-for utilities#3206
laurakwhit merged 3 commits intocodefreeze-03.02.26from
fix-double-resolved-base-path

Conversation

@laurakwhit
Copy link
Collaborator

@laurakwhit laurakwhit commented Feb 28, 2026

Description & motivation 💭

PR #3125 (ESLint v9 upgrade) added resolve() calls to many routeFor* functions. Functions that compose other routeFor* functions ended up calling resolve() multiple times resulting in the base path being prepended multiple times. For example, routeForWorkflows() called resolve(routeForNamespace(...)) which double-resolved to /{base_path)/{base_path)/namespaces/default/workflows.

This PR fixes this by:

  • Fixing instances where routeFor* functions that compose other routeFor* functions were calling resolve() again.
  • Adding gotoResolved() utility that creates a type-safe wrapper around goto() that accepts only ResolvedRoute values, centralizing the eslint-disable for svelte/no-navigation-without-resolve in one place.
  • Adding branded ResolvedRoute type to replace SvelteKit's ResolvedPathname (which is just string) with a branded type that TypeScript enforces at compile time, preventing raw strings from being passed where a resolved route is expected in gotoResolved().
  • Adding base path regression tests and verifying every exported routeFor* functions includes the base path
    exactly once. An additional test automatically fails if a new routeFor* function is added without a corresponding test case.

Screenshots (if applicable) 📸

Design Considerations 🎨

Testing 🧪

How was this tested 👻

  • Manual testing
  • E2E tests added
  • Unit tests added

Steps for others to test: 🚶🏽‍♂️🚶🏽‍♀️

pnpm test src/lib/utilities/route-for-base-path.test.ts

Run the following ⬇️

cd server
docker build -t temporal-ui-local .
docker run -p 5252:8080 -e TEMPORAL_UI_PUBLIC_PATH=/custom-path -e TEMPORAL_ADDRESS=host.docker.internal:7233 temporal-ui-local

pnpm build:server 
pnpm dev:ui-server

Then go to http://localhost:5252/custom-path/namespaces/default and navigate to different links (e.g. /workflows).

  • Verify /custom-path does not appear twice in the URL and links work as expected

Checklists

Draft Checklist

Merge Checklist

Issue(s) closed

Related Slack thread.

Docs

Any docs updates needed?

@vercel
Copy link

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
holocene Ready Ready Preview, Comment Mar 2, 2026 7:42pm

Request Review

@temporal-cicd
Copy link
Contributor

temporal-cicd bot commented Feb 28, 2026

Warnings
⚠️

📊 Strict Mode: 34 errors in 1 file (3.1% of 1109 total)

src/lib/stores/schedules.ts (34)
  • L54:4: 'body.schedule' is possibly 'undefined'.
  • L54:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L55:4: 'body.schedule' is possibly 'undefined'.
  • L55:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L56:4: 'body.schedule' is possibly 'undefined'.
  • L56:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L58:42: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  • L60:4: 'body.schedule' is possibly 'undefined'.
  • L60:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L63:4: 'body.schedule' is possibly 'undefined'.
  • L63:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L64:4: 'body.schedule' is possibly 'undefined'.
  • L64:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L71:4: 'body.schedule' is possibly 'undefined'.
  • L71:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L82:4: 'body.schedule' is possibly 'undefined'.
  • L82:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L83:4: 'body.schedule' is possibly 'undefined'.
  • L83:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L115:65: Property 'message' does not exist on type '{}'.
  • L122:4: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L142:10: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L143:12: 'workflowSearchAttributes' is possibly 'undefined'.
  • L147:43: Argument of type '{ type: "Unspecified" | "Keyword" | "Text" | "Int" | "Double" | "Bool" | "KeywordList" | "Datetime"; label: string; value?: any; }[] | undefined' is not assignable to parameter of type '{ type: "Unspecified" | "Keyword" | "Text" | "Int" | "Double" | "Bool" | "KeywordList" | "Datetime"; label: string; value?: any; }[]'.
  • L204:65: Property 'message' does not exist on type '{}'.
  • L212:4: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L217:13: 'schedule.action' is possibly 'null' or 'undefined'.
  • L222:10: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L228:17: 'body.schedule' is possibly 'undefined'.
  • L228:17: 'body.schedule.action' is possibly 'null' or 'undefined'.
  • L240:65: Property 'message' does not exist on type '{}'.
  • L246:4: 'body.schedule' is possibly 'undefined'.
  • L249:4: 'body.schedule' is possibly 'undefined'.
  • L249:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.

Generated by 🚫 dangerJS against 6185d4a

@laurakwhit laurakwhit marked this pull request as ready for review March 2, 2026 17:33
@laurakwhit laurakwhit requested review from a team, Alex-Tideman and rossedfort as code owners March 2, 2026 17:33
@laurakwhit laurakwhit changed the base branch from main to codefreeze-03.02.26 March 2, 2026 19:54
@laurakwhit laurakwhit merged commit 25144ee into codefreeze-03.02.26 Mar 2, 2026
17 checks passed
@laurakwhit laurakwhit deleted the fix-double-resolved-base-path branch March 2, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants